<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('茶店库存列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <input type="hidden" id="teaShopId" name="teaShopId" th:value="${teaShop.id}">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>原料编号：</label>
                            <input type="text" name="rawMaterialId"/>
                        </li>
                        <li>
                            <label>数量：</label>
                            <input type="text" name="amount"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="deliveryInformation()">
                <i class="fa fa-plus"></i> 确认收货
            </a>
<!--            <a class="btn btn-danger" onclick="consume()">-->
<!--                <i class="fa fa-minus"></i> 消耗-->
<!--            </a>-->
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:teaShopInventory:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var prefix = ctx + "system/shop/teaShopInventory";

    $(function() {
        var options = {
            url: prefix + "/teaShopInventoryList",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "茶店库存",
            columns: [{
                checkbox: true
            },
            {
                field: 'rawMaterialId',
                title: '原料编号'
            },
            {
                field: 'name',
                title: '名称'
            },
            {
                field: 'description',
                title: '描述'
            },
            {
                field: 'amount',
                title: '数量'
            }
                ,
                {
                    field: 'supplier',
                    title: '供应商'
                }
            ]
        };
        $.table.init(options);
    });

    function deliveryInformation(teaShopId) {
        var url = prefix + '/deliveryInformation/' + $("#teaShopId").val();
        $.modal.open("收货信息", url);
    }

    function consume(teaShopId) {
        var url = prefix + '/consume/' + $("#teaShopId").val();
        $.modal.open("消耗", url);
    }
</script>
</body>
</html>